home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / extras / programm / gemfsc20 / gemfsc20.lzh / GEMFUNCS / OBJGSPEC.C < prev    next >
C/C++ Source or Header  |  1993-02-01  |  1KB  |  53 lines

  1. /**************************************************************************
  2.  * OBJGSPEC.C - Get an object's ob_spec; handles INDIRECT & XUSERDEF objs.
  3.  *************************************************************************/
  4.  
  5. #include "gemfintl.h"
  6.  
  7. /*-------------------------------------------------------------------------
  8.  *
  9.  *-----------------------------------------------------------------------*/
  10.  
  11. long obj_gvalue(ptree, obj)
  12.     OBJECT *ptree;
  13.     short    obj;
  14. {
  15.     long        obspec;
  16.     XUSERBLK   *xub;
  17.  
  18.     obspec = (long)ptree[obj].ob_spec;
  19.     if (ptree[obj].ob_flags & INDIRECT) {
  20.         obspec = *(long *)obspec;
  21.     }
  22.     if ((ptree[obj].ob_type & 0x00FF) == G_USERDEF) {
  23.         xub = (XUSERBLK *)obspec;
  24.         if (xub->ub_self == xub) {
  25.             obspec = (long)xub->ob_spec;
  26.         }
  27.     }
  28.  
  29.     return obspec;
  30. }
  31.  
  32. void obj_svalue(ptree, obj, newvalue)
  33.     OBJECT *ptree;
  34.     short    obj;
  35.     long    newvalue;
  36. {
  37.     long       *pspec;
  38.     XUSERBLK   *xub;
  39.  
  40.     pspec = (long*)&ptree[obj].ob_spec;
  41.     if (ptree[obj].ob_flags & INDIRECT) {
  42.         pspec = *(long **)pspec;
  43.     }
  44.     if ((ptree[obj].ob_type & 0x00FF) == G_USERDEF) {
  45.         xub = *(XUSERBLK **)pspec;
  46.         if (xub->ub_self == xub) {
  47.             pspec = *(long**)xub->ob_spec;
  48.         }
  49.     }
  50.  
  51.     *pspec = newvalue;
  52. }
  53.